#include<iostream>
#include<string>
using namespace std;

bool LoopWord(string L1, string L2)
{
    string tmp = L2 + L2;
    if (tmp.find(L1) != string::npos)
        return true;
    else
        return false;
}

int main()
{
    string L1("abcdef"), L2("efabcd");

    if (LoopWord(L1, L2))
        cout << "Yes" << endl;
    else
        cout << "No" << endl;

	return 0;
}